#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;

int n, p = 0;
int primes[9] = {2, 3, 5, 7, 11, 13, 17, 19, 23};
int maxnum;

void dfs(int index, int num, int cnt){

    if(cnt > p){
        p = cnt;
        maxnum = num;
    }else if(cnt == p && num < maxnum){
        maxnum = num;
    }

    if(index == 9)return;

    for(int i = 1; i <= 30; i ++){
        if((LL)num * primes[index] >= n) break;
        num = (LL)num * primes[index];
        dfs(index + 1, num, cnt*(i + 1));
    }
}


int main(){


    cin >> n;
    maxnum = n;
    dfs(0, 1, 1);
    cout << maxnum << '\n';
    return 0;
}